package com.fjnldx.ks.controller;


import com.fjnldx.ks.pojo.response.Result;
import com.fjnldx.ks.service.MesForthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 11759
 */
@Api(value = "Mes项目测试Api")
@RestController
@RequestMapping("/api-test")
public class TestController {
    @Autowired
    MesForthService mesForthService;

    @GetMapping("/mesTest")
    @ApiOperation(value = "测试控制器", notes = "测试")
    public String mesTest() {
        String property = System.getProperty("user.dir");
        System.out.println(property);
        return property;
    }

    @PostMapping("/upload")
    @ApiOperation(value = "文件上传测试", notes = "测试")
    public Result upload(@RequestParam("file") MultipartFile file) {
        Result result = mesForthService.uploadExcelFile(file);
        return result;
    }

    @PostMapping("/cache")
    @ApiOperation(value = "测试缓存", notes = "测试")
    public String cacheTest() {
        String user = mesForthService.findUser();
        return user;
    }

    @PostMapping("/deleteCache")
    @ApiOperation(value = "删除缓存", notes = "测试")
    public String deleteCacheTest() {
        mesForthService.deleteCache();
        return "删除缓存";
    }
}
